package com.sdx.console.promote.service;

import java.util.List;

import com.ibeetl.admin.core.entity.BaseEntity;
import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.promote.dao.PromoteCommissionDao;
import com.sdx.console.promote.entity.PromoteCommission;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 佣金定义 Service
 */

@Service
@Transactional
public class PromoteCommissionService extends BaseService<PromoteCommission>{

    @Resource
	private PromoteCommissionDao promoteCommissionDao;

    public PageQuery<PromoteCommission>queryByCondition(PageQuery query){
        PageQuery ret =  promoteCommissionDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelPromoteCommission(List<String> ids,Integer tenantId){
        try {
            promoteCommissionDao.batchDelPromoteCommissionByIds(ids,tenantId);
        } catch (Exception e) {
            throw new PlatformException("批量删除佣金定义失败", e);
        }
    }

    public PromoteCommission queryPromoteCommission(Integer orderType,Integer tenantId){
            return promoteCommissionDao.queryPromoteCommission(orderType,tenantId);
    }

    public BaseEntity selectOrderType(Integer orderType){
        return promoteCommissionDao.selectOrderType( orderType);
    }

	public List<PromoteCommission> all() {
		return promoteCommissionDao.all();
		}


}